package com.tenglong.teacher.ui.homework.msgviewholder;


import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.tenglong.teacher.R;
import com.tenglong.teacher.ui.homework.HWTitle;


public class HWTitleViewHolder extends HWBaseViewHolder {
    protected TextView bodyTextView;

    public HWTitleViewHolder(View itemView) {
        super(itemView);
        bodyTextView = itemView.findViewById(R.id.title);
    }

    public void onBindViewHolder(IMMessage msg) {
        super.onBindViewHolder(msg);
        bodyTextView.setText(((HWTitle) getDisplayText(msg)).content);
        switch (((HWTitle) getDisplayText(msg)).id) {
            case 0:
                bodyTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tijiao,0,0,0);
                break;
            case 1:
                bodyTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.pigai,0,0,0);
                break;
            case 2:
                bodyTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.zuoye,0,0,0);
                break;
        }
    }

    @Override
    protected void onItemClick(View v) {
    }

    protected MsgAttachment getDisplayText(IMMessage msg) {
        return msg.getAttachment();
    }
}
